All right.
So we have one more thing that we got to fix on our data store, on our saving data.
Right.
We we check to see if our data was not successful, kicking the player, hoping to preserve the data
store.
We didn't want to save off bad data, but when we kick the player, the player removing will fire.
We could possibly save off bad data.
So let's handle that situation.
And it's also going to lead into other information that I want to save on the player that's not going
to be leaderboard centric.
Let's go underneath where we do all of our leaderboard stuff on ad board, and I'm going to make another
folder local.
I'm going to call this player info.
I'm going to say, instance dot new.
This is going to be a folder.
We're going to put it on the player and let's give player info dot name.
I'm going to make this all lowercase in the spirit of the leader stats.
I don't like to make things that are in the workspace lowercase, but that's what they do.
So I'm going to call this player info and then on player info, I'm going to put a variable for bad
data, whether it's good or bad, let's say local, more of a flag, bad data equals instance new.
It's going to be a boolean value that's going to be on player info.
We'll give it a name by data dot name.
And I think I'm going to go with the spirit of the things that are on the leader board with the capital
letter.
I'm not going to use the camel case.
I'm going to use a space.
I'm going to say bad data.
All right.
And then we'll give it we'll initialize a value of false.
We're going to start out assuming the data is good and we're going to leave it like that unless they
get kicked on that initialize.
So bad data equals false, it should be good, but there could be a case where it's bad.
So we come down to initialize data.
The P call is unsuccessful.
We're going to come in here, we're going to say player dot player info and then our player info.
We have to use the square brackets with the speech quotes because we call this bad data.
Dot value is now true.
It's bad data because we got kicked because this was unsuccessful.
Let's copy this.
Control C.
Let's go down to where we're saving the data.
Let's say, if not bad data, then we'll save.
And then else let's do a format format document.
There we go.
Else.
Let's do a little print out, letting letting us know that there was a problem.
Print.
The data was corrupted, not saving.
There.
That should work.
Let's give it a try to make sure we can play.
Okay?
We can get our data.
Let's go to view.
Let's go to output.
Hit the play button.
Now we have some we have some data already saved.
Cannot write unreachable.
The data was corrupted.
Not saving are.
Maybe it's because.
Game settings.
Look at that.
Now enable studio access to API services.
We fixed our problem.
Now let's try it.
Look at that.
We got our data.
We had an unsuccessful attempt of getting in.
We didn't mess anything up.
It said that the data was bad.
Now we're back in, Everything's happy.
We don't have to rage about our our bad data, our loss of data.
Like if you had 1000 day streak or something and then it was gone, that would be sad.
All right.
So I think I'll do Daily Streak next.
Let's go ahead and get started.